//
//  ZealcommNetWorkTool.h
//  irtc_sipcall
//
//  Created by zealcomm user on 2020/4/21.
//  Copyright © 2020 zealcomm user. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN

@interface ZealcommNetWorkTool : NSObject

declareSingleInstance(NetWorkTool)

/**
 *  发送get请求
 *
 *  @param url                      请求路径
 *  @param parameters               请求参数
 *  @param header                   请求头Header
 *  @param success                  请求成功后的回调,参数为id类型
 *  @param failure                  请求失败后的回调
 */
- (void)GET:(NSString *)url
          parameters:(_Nullable id)parameters
HeaderKeyValues:( NSDictionary * _Nullable )header
          success:(void (^)(id responseObject))success
          failure:(void (^)(NSError *error))failure;



/**
 *  发送post请求
 *
 *  @param url          请求路径
 *  @param parameters   请求参数
 *  @param header       请求头Header
 *  @param success      请求成功后的回调,参数为id类型
 *  @param failure      请求失败后的回调
 */
- (void)POST:(NSString *)url
          parameters:(_Nullable id)parameters
          HeaderKeyValues:(NSDictionary * _Nullable)header
          success:(void (^)(id responseObject))success
          failure:(void (^)(NSError *error))failure;



/// 删除操作
/// @param url url
/// @param parameters 参数
/// @param header headers
/// @param success 成功
/// @param failure 失败
- (void)DELETE:(NSString *)url
            parameters:(_Nullable id)parameters
            HeaderKeyValues:(NSDictionary * _Nullable)header
            success:(void (^)(id responseObject))success
            failure:(void (^)(NSError *error))failure;



/// 上传图片
/// @param url 上传地址
/// @param image 图片
/// @param fileName fileName
/// @param mimeType 文件类型
/// @param parameters 参数
/// @param header headers
/// @param success 成功
/// @param failure 失败
- (void)Upload:(NSString *)url
          image:(UIImage *)image
          fileName:(nonnull NSString *)fileName
          mimeType:(NSString *)mimeType
          parameters:(_Nullable id)parameters
          HeaderKeyValues:(NSDictionary * _Nullable)header
          success:(void (^)(id responseObject))success
          failure:(void (^)(NSError *error))failure;



/// 上传文件
/// @param url 上传地址
/// @param fileData fileData
/// @param fileName fileName
/// @param mimeType 文件类型
/// @param parameters 参数
/// @param header headers
/// @param success 成功
/// @param failure 失败
- (void)Upload:(NSString *)url
          fileData:(NSData *)fileData
          fileName:(nonnull NSString *)fileName
          mimeType:(NSString *)mimeType
          parameters:(_Nullable id)parameters
          HeaderKeyValues:(NSDictionary * _Nullable)header
          success:(void (^)(id responseObject))success
          failure:(void (^)(NSError *error))failure;

@end

NS_ASSUME_NONNULL_END
